<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: index.tpl 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
?>
<?php 
	$this->headLink()
  ->appendStylesheet($this->layout()->staticBaseUrl
    . 'application/modules/Sitealbum/externals/styles/style_sitealbum.css')
?>
<?php
if($this->showLightBox):
include_once APPLICATION_PATH . '/application/modules/Sitealbum/views/scripts/_lightboxPhoto.tpl';
endif;
$i=0;
?>
<?php if($this->count>0): ?>
<?php if (empty($this->is_ajax)) : ?>
  <div id='photo_image_recent' class="seaocore_photo_strips">
  <?php endif; ?>		
  <?php foreach ($this->paginator as $photo):?>
    <div class="thumb_photo"> 
        <a href="<?php echo $photo->getHref() ?>"  <?php if ($this->showLightBox): ?> onclick='openLightBoxAlbum("<?php echo $photo->getPhotoUrl() ?>","<?php echo Engine_Api::_()->sitealbum()->getLightBoxPhotoHref($photo,array_merge($this->params, array('offset'=>$i))) ?>");return false;' <?php endif; ?> title="<?php echo $photo->title; ?>" style="background-image:url(<?php echo $photo->getPhotoUrl('thumb.normal'); ?>);" class="thumb_img">
        </a>
     
      <?php if ($this->canEdit): ?>
        <div id='hide_<?php echo $photo->getIdentity(); ?>' class="photo_hide">
          <a href="javascript:void(0);" title="<?php echo $this->translate('Hide this photo'); ?>" onclick="hideAlbumPhoto(<?php echo $photo->photo_id; ?>);" ></a>

        </div>
      <?php endif; ?>
    </div>
    <?php $i++; ?>
  <?php endforeach; ?>
     <?php
     for ($i=$this->hidePhoto; $i < $this->limit - $this->count; $i++ ): ?>
      <div class="thumb_photo">
      </div>
     <?php endfor; ?>
     <?php if($this->hidePhoto && $this->canEdit && $this->count < $this->limit): ?>
      <div class="thumb_photo">
        <a href='javascript:void(0);' title="<?php echo $this->translate('Reset Photo Strip'); ?>" onclick='opensmoothbox("<?php echo $this->url(array('action' => 'unhide-photo', 'user_id' => $this->subject()->getIdentity()), 'sitealbum_extended', true) ?>");return false;'>
          <img src='<?php echo $this->layout()->staticBaseUrl ?>application/modules/Sitealbum/externals/images/photoreset.png' />
        </a>
      </div>
    <?php endif; ?>
       
  
  <?php if (empty($this->is_ajax)) : ?>
  </div> 
<?php endif; ?>





<script type="text/javascript">

  var submit_topageprofile = true;
  function hideAlbumPhoto(photo_id)
  {	
    submit_topageprofile = false;
   
    en4.core.request.send(new Request.HTML({     
      method : 'post',
      'url' : en4.core.baseUrl + 'widget/index/mod/sitealbum/name/photo-strips',
      'data' : {
        format : 'html',
        'subject' : '<?php echo $this->subject()->getGuid() ?>',
        isajax : 1,
        itemCountPerPage:'<?php echo $this->limit ?>',
        hide_photo_id : photo_id
      },
      onSuccess : function(responseTree, responseElements, responseHTML, responseJavaScript) {
        $('photo_image_recent').innerHTML = responseHTML;
      }
    }));
	
    return false;

  }

  function ShowPhotoPage(pageurl) {
    if (submit_topageprofile) {
      window.location = pageurl;
    }
    else {
      submit_topageprofile = true;
    }
  }


  function opensmoothbox(url) {
    Smoothbox.open(url);
  }
</script>
<?php endif; ?>